<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/22/022
 * Time: 15:26
 */
namespace App\Http\Controllers\Wechat;

use EasyWeChat\Factory;
use EasyWeChat\Kernel\Messages\Text;
use EasyWeChat\Kernel\Messages\TextCard;
use Illuminate\Support\Facades\Log;

class IndexController extends \App\Http\Controllers\Controller
{
	public function index(){
		/*Log::info('request arrived.');
		$app = config('wechat.official_account');
		dd(config('wechat.official_account'));
		$app->server->push(function($message){
			return "欢迎关注 me！";
		});
		return $app->server->serve();*/
		$config = config('wechat.official_account.default');
		$app = Factory::officialAccount($config);
		$app->server->push(function($message){
			return new Text('试试就试试');
		});
		$response = $app->server->serve();
		return $response;
	}


}